---
title: "Is a Picture Worth 280 Characters?"
subtitle: "Experiment 3 (Appendix D)" 
author: "Benjamin Norwood Harris"
output: pdf_document
---

```{r}

library(stargazer)
library(lmtest)
library(ggplot2)
library(stringr)
library(TOSTER)


#set WD and read in data.  

setwd("/Users/harri/Dropbox (MIT)/Is a Picture Worth 280 Characters (Updated)/JEPS, Submission Folder, July 2023/JEPS 2nd R+R/Replication Materials/")
DF3 <-read.csv("Data, Experiment 3, November 2023.csv", fileEncoding = "UTF-8-BOM")

```


#Demographic Table Stats 



```{r}
### demographics 

table(DF3$Q.Female)

length(na.omit(DF3$Q.Female[DF3$Q.Female==0]))/length(DF3$Q.Female)
sum(na.omit(DF3$Q.Female))/length(DF3$Q.Female)

sum(is.na(DF3$Q.Female))/length(DF3$Q.Female)

```


```{r}
sum(na.omit(DF3$Q.White))/length((DF3$Q.White))
sum(na.omit(DF3$Q.Black))/length((DF3$Q.Black))
```


```{r}
sum(na.omit(DF3$Q.AIorAN))/length((DF3$Q.AIorAN))
sum(na.omit(DF3$Q.Asian))/length((DF3$Q.Asian))
```


```{r}
sum(na.omit(DF3$Q.NHorPI))/length((DF3$Q.NHorPI))
sum(na.omit(DF3$Q.Hispanic))/length((DF3$Q.Hispanic))
```


```{r}
sum(na.omit(DF3$Q.Mixed))/length((DF3$Q.Mixed))
sum(na.omit(DF3$Q.Other))/length((DF3$Q.Other))
```


```{r}
sum(na.omit(DF3$Q.Other_Mixed))/length((DF3$Q.Other_Mixed))
sum(is.na(DF3$Q.Race))/length(DF3$Q.Race)



```


```{r}
summary(DF3$Q.Age)
```


```{r}


table(DF3$Q.Education)

sum((na.omit(DF3$Q.HighSchool)))/length((DF3$Q.HighSchool))
sum((na.omit(DF3$Q.Bach)))/length((DF3$Q.Bach))

sum(is.na(DF3$Q.Education))/length(DF3$Q.Education)

```


```{r}
table(DF3$Q.Income)


length(na.omit(DF3$Q.Income[DF3$Q.Income==1]))/length(DF3$Q.Income)
length(na.omit(DF3$Q.Income[DF3$Q.Income==2]))/length(DF3$Q.Income)
```


```{r}
length(na.omit(DF3$Q.Income[DF3$Q.Income==3]))/length(DF3$Q.Income)
length(na.omit(DF3$Q.Income[DF3$Q.Income==4]))/length(DF3$Q.Income)
```


```{r}
length(na.omit(DF3$Q.Income[DF3$Q.Income==5]))/length(DF3$Q.Income)
length(na.omit(DF3$Q.Income[DF3$Q.Income==6]))/length(DF3$Q.Income)
```


```{r}
length(na.omit(DF3$Q.Income[DF3$Q.Income==7]))/length(DF3$Q.Income)
length(na.omit(DF3$Q.Income[DF3$Q.Income==8]))/length(DF3$Q.Income)



sum(is.na(DF3$Q.Income))/length(DF3$Q.Income)

```


```{r}


table(DF3$Q.Political_ID)

sum(na.omit(DF3$Q.Liberal))/length((DF3$Q.Liberal))
sum(na.omit(DF3$Q.Moderate))/length((DF3$Q.Moderate))
sum(na.omit(DF3$Q.Conservative))/length((DF3$Q.Conservative))


sum(is.na(DF3$Q.Political_ID))/length(DF3$Q.Political_ID)

```


```{r}

table(DF3$Q.Veteran)
length(na.omit(DF3$Q.Veteran[DF3$Q.Veteran==0]))/length(DF3$Q.Veteran)
length(na.omit(DF3$Q.Veteran[DF3$Q.Veteran==1]))/length(DF3$Q.Veteran)

sum(is.na(DF3$Q.Veteran))/length(DF3$Q.Veteran)


```




```{r}

#Twitter_Use 

table(DF3$Q.Twitter_Use)



length(na.omit(DF3$Q.Twitter_Use[DF3$Q.Twitter_Use==1]))/length(DF3$Q.Twitter_Use)
length(na.omit(DF3$Q.Twitter_Use[DF3$Q.Twitter_Use==2]))/length(DF3$Q.Twitter_Use)
length(na.omit(DF3$Q.Twitter_Use[DF3$Q.Twitter_Use==3]))/length(DF3$Q.Twitter_Use)
length(na.omit(DF3$Q.Twitter_Use[DF3$Q.Twitter_Use==4]))/length(DF3$Q.Twitter_Use)
length(na.omit(DF3$Q.Twitter_Use[DF3$Q.Twitter_Use==5]))/length(DF3$Q.Twitter_Use)
sum(is.na(DF3$Q.Twitter_Use))/length(DF3$Q.Twitter_Use)

```



# Analysis 

## Substantive Questions

```{r}
#time for some regressions 


##DV: Nuclear Approval, IV: all three  

## Model 1: No Demographics 

NukeAppr_Form_1 <- Nuclear_Approval ~ Newspaper + Long + NukeAdv   

## Model 5: Factor Demographics 

NukeAppr_Form_5 <- Nuclear_Approval ~ Newspaper + Long + NukeAdv + 
  Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

NukeAppr_Form_7 <- Nuclear_Approval ~ Newspaper + Long + NukeAdv +    
  Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

NukeAppr_1 <- lm(NukeAppr_Form_1, 
             data = DF3, 
             na.action=na.omit)

NukeAppr_5 <- lm(NukeAppr_Form_5, 
             data = DF3, 
             na.action=na.omit)

NukeAppr_7 <- lm(NukeAppr_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(NukeAppr_1, NukeAppr_5, NukeAppr_7, title = "Prolific, Nuclear Approval", no.space = TRUE)

```


```{r}
summary(NukeAppr_5)
```


```{r}
#time for some regressions 


##DV: Conventional Approval, IV: all three  

## Model 1: No Demographics 

ConvAppr_Form_1 <- Conv_Approval ~ Newspaper + Long + NukeAdv  

## Model 5: Factor Demographics 

ConvAppr_Form_5 <- Conv_Approval ~ Newspaper + Long + NukeAdv + 
  Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

ConvAppr_Form_7 <- Conv_Approval ~ Newspaper + Long + NukeAdv +    
  Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

ConvAppr_1 <- lm(ConvAppr_Form_1, 
             data = DF3, 
             na.action=na.omit)

ConvAppr_5 <- lm(ConvAppr_Form_5, 
             data = DF3, 
             na.action=na.omit)

ConvAppr_7 <- lm(ConvAppr_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(ConvAppr_1, ConvAppr_5, ConvAppr_7, title = "Prolific, Conventional Approval", no.space = TRUE)

```

```{r}
summary(ConvAppr_5)

```



```{r}
#time for some regressions 


##DV: Choice , IV: all three  

## Model 1: No Demographics 

Choice_Form_1 <- Choice ~ Newspaper + Long + NukeAdv  

## Model 5: Factor Demographics 

Choice_Form_5 <- Choice ~ Newspaper + Long + NukeAdv + 
  Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

Choice_Form_7 <- Choice ~ Newspaper + Long + NukeAdv +    
  Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

Choice_1 <- lm(Choice_Form_1, 
             data = DF3, 
             na.action=na.omit)

Choice_5 <- lm(Choice_Form_5, 
             data = DF3, 
             na.action=na.omit)

Choice_7 <- lm(Choice_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(Choice_1, Choice_5, Choice_7, title = "Prolific, Choice", no.space = TRUE)

```


```{r}
summary(Choice_5)
```
## Experiential 

```{r}
#time for some regressions 


##DV: Interest , IV: all three  

## Model 1: No Demographics 

Interest_Form_1 <- Interest ~ Newspaper + Long + NukeAdv  

## Model 5: Factor Demographics 

Interest_Form_5 <- Interest ~ Newspaper + Long + NukeAdv + 
  Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

Interest_Form_7 <- Interest ~ Newspaper + Long + NukeAdv +    
  Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

Interest_1 <- lm(Interest_Form_1, 
             data = DF3, 
             na.action=na.omit)

Interest_5 <- lm(Interest_Form_5, 
             data = DF3, 
             na.action=na.omit)

Interest_7 <- lm(Interest_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(Interest_1, Interest_5, Interest_7, title = "Prolific, Interest", no.space = TRUE)

```


```{r}
summary(Interest_5)
```


```{r}
#time for some regressions 


##DV: Enjoyment , IV: all three  

## Model 1: No Demographics 

Enjoyment_Form_1 <- Enjoyment ~ Newspaper + Long + NukeAdv  

## Model 5: Factor Demographics 

Enjoyment_Form_5 <- Enjoyment ~ Newspaper + Long + NukeAdv + 
  Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

Enjoyment_Form_7 <- Enjoyment ~ Newspaper + Long + NukeAdv +    
  Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

Enjoyment_1 <- lm(Enjoyment_Form_1, 
             data = DF3, 
             na.action=na.omit)

Enjoyment_5 <- lm(Enjoyment_Form_5, 
             data = DF3, 
             na.action=na.omit)

Enjoyment_7 <- lm(Enjoyment_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(Enjoyment_1, Enjoyment_5, Enjoyment_7, title = "Prolific, Enjoyment", no.space = TRUE)

```


```{r}
summary(Enjoyment_5)
```


```{r}
#time for some regressions 


##DV: Cog_Load , IV: all three  

## Model 1: No Demographics 

Cog_Load_Form_1 <- Cog_Load ~ Newspaper + Long + NukeAdv  

## Model 5: Factor Demographics 

Cog_Load_Form_5 <- Cog_Load ~ Newspaper + Long + NukeAdv + 
  Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

Cog_Load_Form_7 <- Cog_Load ~ Newspaper + Long + NukeAdv +    
  Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

Cog_Load_1 <- lm(Cog_Load_Form_1, 
             data = DF3, 
             na.action=na.omit)

Cog_Load_5 <- lm(Cog_Load_Form_5, 
             data = DF3, 
             na.action=na.omit)

Cog_Load_7 <- lm(Cog_Load_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(Cog_Load_1, Cog_Load_5, Cog_Load_7, title = "Prolific, Cog_Load", no.space = TRUE)

```

```{r}

summary(Cog_Load_5)

```



```{r}
#time for some regressions 


##DV: Crisis_Realism , IV: all three  

## Model 1: No Demographics 

Crisis_Realism_Form_1 <- Crisis_Realism ~ Newspaper + Long + NukeAdv  

## Model 5: Factor Demographics 

Crisis_Realism_Form_5 <- Crisis_Realism ~ Newspaper + Long + NukeAdv + 
  Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

Crisis_Realism_Form_7 <- Crisis_Realism ~ Newspaper + Long + NukeAdv +    
  Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

Crisis_Realism_1 <- lm(Crisis_Realism_Form_1, 
             data = DF3, 
             na.action=na.omit)

Crisis_Realism_5 <- lm(Crisis_Realism_Form_5, 
             data = DF3, 
             na.action=na.omit)

Crisis_Realism_7 <- lm(Crisis_Realism_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(Crisis_Realism_1, Crisis_Realism_5, Crisis_Realism_7, title = "Prolific, Crisis_Realism", no.space = TRUE)

```

```{r}
summary(Crisis_Realism_5)
```
## AC and Timer 

```{r}
#time for some regressions 


##DV: Timer , IV: all three  

## Model 1: No Demographics 

Timer_Form_1 <- Timer ~ Newspaper + Long + NukeAdv  

## Model 5: Factor Demographics 

Timer_Form_5 <- Timer ~ Newspaper + Long + NukeAdv + 
  Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

Timer_Form_7 <- Timer ~ Newspaper + Long + NukeAdv +    
  Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

Timer_1 <- lm(Timer_Form_1, 
             data = DF3, 
             na.action=na.omit)

Timer_5 <- lm(Timer_Form_5, 
             data = DF3, 
             na.action=na.omit)

Timer_7 <- lm(Timer_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(Timer_1, Timer_5, Timer_7, title = "Prolific, Timer", no.space = TRUE)

```

```{r}
summary(Timer_5)
```


```{r}
#time for some regressions 


##DV: Country_Check_Binary , IV: all three  

## Model 1: No Demographics 

Country_Check_Binary_Form_1 <- Country_Check_Binary ~ Newspaper + Long + NukeAdv  

## Model 5: Factor Demographics 

Country_Check_Binary_Form_5 <- Country_Check_Binary ~ Newspaper + Long + NukeAdv + 
  Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

Country_Check_Binary_Form_7 <- Country_Check_Binary ~ Newspaper + Long + NukeAdv +    
  Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

Country_Check_Binary_1 <- lm(Country_Check_Binary_Form_1, 
             data = DF3, 
             na.action=na.omit)

Country_Check_Binary_5 <- lm(Country_Check_Binary_Form_5, 
             data = DF3, 
             na.action=na.omit)

Country_Check_Binary_7 <- lm(Country_Check_Binary_Form_7, 
             data = DF3, 
             na.action=na.omit)

stargazer(Country_Check_Binary_1, Country_Check_Binary_5, Country_Check_Binary_7, title = "Prolific, Country Check", no.space = TRUE)


```


```{r}
#time for some regressions 


##DV: Author_Check_Binary , IV: all three  

## Model 1: No Demographics 

Author_Check_Binary_Form_1 <- Author_Check_Binary ~ Newspaper + Long + NukeAdv  

## Model 5: Factor Demographics 

Author_Check_Binary_Form_5 <- Author_Check_Binary ~ Newspaper + Long + NukeAdv + 
  Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

Author_Check_Binary_Form_7 <- Author_Check_Binary ~ Newspaper + Long + NukeAdv +    
  Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

Author_Check_Binary_1 <- lm(Author_Check_Binary_Form_1, 
             data = DF3, 
             na.action=na.omit)

Author_Check_Binary_5 <- lm(Author_Check_Binary_Form_5, 
             data = DF3, 
             na.action=na.omit)

Author_Check_Binary_7 <- lm(Author_Check_Binary_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(Author_Check_Binary_1, Author_Check_Binary_5, Author_Check_Binary_7, title = "Prolific, Author Check", no.space = TRUE)

```

```{r}
#time for some regressions 


##DV: Scientist_Check_Binary , IV: all three  

## Model 1: No Demographics 

Scientist_Check_Binary_Form_1 <- Scientist_Check_Binary ~ Newspaper + Long + NukeAdv  

## Model 5: Factor Demographics 

Scientist_Check_Binary_Form_5 <- Scientist_Check_Binary ~ Newspaper + Long + NukeAdv + 
  Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))
  
## Model 7: Slightly simplified for the Appendix 

Scientist_Check_Binary_Form_7 <- Scientist_Check_Binary ~ Newspaper + Long + NukeAdv +    
  Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some

#regression 

Scientist_Check_Binary_1 <- lm(Scientist_Check_Binary_Form_1, 
             data = DF3, 
             na.action=na.omit)

Scientist_Check_Binary_5 <- lm(Scientist_Check_Binary_Form_5, 
             data = DF3, 
             na.action=na.omit)

Scientist_Check_Binary_7 <- lm(Scientist_Check_Binary_Form_7, 
             data = DF3, 
             na.action=na.omit)


stargazer(Scientist_Check_Binary_1, Scientist_Check_Binary_5, Scientist_Check_Binary_7, title = "Prolific, Scientist Check", no.space = TRUE)

```


## P-Values


```{r}

summary(NukeAppr_7)$coefficients[2,]
summary(ConvAppr_7)$coefficients[2,]
summary(Choice_7)$coefficients[2,]
summary(Crisis_Realism_7)$coefficients[2,]

summary(Timer_7)$coefficients[2,]
summary(Scientist_Check_Binary_7)$coefficients[2,]
summary(Author_Check_Binary_7)$coefficients[2,]
summary(Country_Check_Binary_7)$coefficients[2,]

summary(Cog_Load_7)$coefficients[2,]
summary(Enjoyment_7)$coefficients[2,]
summary(Interest_7)$coefficients[2,]


```





# Means and SE Estimates 

## Substantive Questions 


```{r}

##### Nuclear Approval 

NukeAppr_Form_1 <- Nuclear_Approval ~ Newspaper + Long + NukeAdv   


NukeAppr_Full <- Nuclear_Approval ~ 0 + as.factor(Treatment) 


lm_NukeAppr_Full <- lm(NukeAppr_Full, 
                     data = DF3)

summary(lm_NukeAppr_Full)

length(na.omit(DF3$Nuclear_Approval[DF3$Treatment=="Newspaper,Long,Equal"]))
length(na.omit(DF3$Nuclear_Approval[DF3$Treatment=="Newspaper,Long,NuclearBetter"]))
length(na.omit(DF3$Nuclear_Approval[DF3$Treatment=="Newspaper,Short,Equal"]))
length(na.omit(DF3$Nuclear_Approval[DF3$Treatment=="Newspaper,Short,NuclearBetter"]))
length(na.omit(DF3$Nuclear_Approval[DF3$Treatment=="PlainText,Long,Equal"]))
length(na.omit(DF3$Nuclear_Approval[DF3$Treatment=="PlainText,Long,NuclearBetter"]))
length(na.omit(DF3$Nuclear_Approval[DF3$Treatment=="PlainText,Short,Equal"]))
length(na.omit(DF3$Nuclear_Approval[DF3$Treatment=="PlainText,Short,NuclearBetter"]))


```

```{r}

##### Convetional Approval 

ConvAppr_Form_1 <- Conv_Approval ~ Newspaper + Long + NukeAdv   


ConvAppr_Full <- Conv_Approval ~ 0 + as.factor(Treatment) 


lm_ConvAppr_Full <- lm(ConvAppr_Full, 
                     data = DF3)

summary(lm_ConvAppr_Full)

length(na.omit(DF3$Conv_Approval[DF3$Treatment=="Newspaper,Long,Equal"]))
length(na.omit(DF3$Conv_Approval[DF3$Treatment=="Newspaper,Long,NuclearBetter"]))
length(na.omit(DF3$Conv_Approval[DF3$Treatment=="Newspaper,Short,Equal"]))
length(na.omit(DF3$Conv_Approval[DF3$Treatment=="Newspaper,Short,NuclearBetter"]))
length(na.omit(DF3$Conv_Approval[DF3$Treatment=="PlainText,Long,Equal"]))
length(na.omit(DF3$Conv_Approval[DF3$Treatment=="PlainText,Long,NuclearBetter"]))
length(na.omit(DF3$Conv_Approval[DF3$Treatment=="PlainText,Short,Equal"]))
length(na.omit(DF3$Conv_Approval[DF3$Treatment=="PlainText,Short,NuclearBetter"]))


```

```{r}

##### Choice 

Choice_Form_1 <- Choice ~ Newspaper + Long + NukeAdv   


Choice_Full <- Choice ~ 0 + as.factor(Treatment) 


lm_Choice_Full <- lm(Choice_Full, 
                     data = DF3)

summary(lm_Choice_Full)

length(na.omit(DF3$Choice[DF3$Treatment=="Newspaper,Long,Equal"]))
length(na.omit(DF3$Choice[DF3$Treatment=="Newspaper,Long,NuclearBetter"]))
length(na.omit(DF3$Choice[DF3$Treatment=="Newspaper,Short,Equal"]))
length(na.omit(DF3$Choice[DF3$Treatment=="Newspaper,Short,NuclearBetter"]))
length(na.omit(DF3$Choice[DF3$Treatment=="PlainText,Long,Equal"]))
length(na.omit(DF3$Choice[DF3$Treatment=="PlainText,Long,NuclearBetter"]))
length(na.omit(DF3$Choice[DF3$Treatment=="PlainText,Short,Equal"]))
length(na.omit(DF3$Choice[DF3$Treatment=="PlainText,Short,NuclearBetter"]))


```

```{r}

##### Crisis Realism 

Crisis_Realism_Form_1 <- Crisis_Realism ~ Newspaper + Long + NukeAdv   


Crisis_Realism_Full <- Crisis_Realism ~ 0 + as.factor(Treatment) 


lm_Crisis_Realism_Full <- lm(Crisis_Realism_Full, 
                     data = DF3)

summary(lm_Crisis_Realism_Full)

length(na.omit(DF3$Crisis_Realism[DF3$Treatment=="Newspaper,Long,Equal"]))
length(na.omit(DF3$Crisis_Realism[DF3$Treatment=="Newspaper,Long,NuclearBetter"]))
length(na.omit(DF3$Crisis_Realism[DF3$Treatment=="Newspaper,Short,Equal"]))
length(na.omit(DF3$Crisis_Realism[DF3$Treatment=="Newspaper,Short,NuclearBetter"]))
length(na.omit(DF3$Crisis_Realism[DF3$Treatment=="PlainText,Long,Equal"]))
length(na.omit(DF3$Crisis_Realism[DF3$Treatment=="PlainText,Long,NuclearBetter"]))
length(na.omit(DF3$Crisis_Realism[DF3$Treatment=="PlainText,Short,Equal"]))
length(na.omit(DF3$Crisis_Realism[DF3$Treatment=="PlainText,Short,NuclearBetter"]))


```

## AC and Timer 

```{r}

##### Timer

Timer_Form_1 <- Timer ~ Newspaper + Long + NukeAdv   


Timer_Full <- Timer ~ 0 + as.factor(Treatment) 


lm_Timer_Full <- lm(Timer_Full, 
                     data = DF3)

summary(lm_Timer_Full)

length(na.omit(DF3$Timer[DF3$Treatment=="Newspaper,Long,Equal"]))
length(na.omit(DF3$Timer[DF3$Treatment=="Newspaper,Long,NuclearBetter"]))
length(na.omit(DF3$Timer[DF3$Treatment=="Newspaper,Short,Equal"]))
length(na.omit(DF3$Timer[DF3$Treatment=="Newspaper,Short,NuclearBetter"]))
length(na.omit(DF3$Timer[DF3$Treatment=="PlainText,Long,Equal"]))
length(na.omit(DF3$Timer[DF3$Treatment=="PlainText,Long,NuclearBetter"]))
length(na.omit(DF3$Timer[DF3$Treatment=="PlainText,Short,Equal"]))
length(na.omit(DF3$Timer[DF3$Treatment=="PlainText,Short,NuclearBetter"]))


```

```{r}

##### Scientist_Check_Binary

Scientist_Check_Binary_Form_1 <- Scientist_Check_Binary ~ Newspaper + Long + NukeAdv   


Scientist_Check_Binary_Full <- Scientist_Check_Binary ~ 0 + as.factor(Treatment) 


lm_Scientist_Check_Binary_Full <- lm(Scientist_Check_Binary_Full, 
                     data = DF3)

summary(lm_Scientist_Check_Binary_Full)

length(na.omit(DF3$Scientist_Check_Binary[DF3$Treatment=="Newspaper,Long,Equal"]))
length(na.omit(DF3$Scientist_Check_Binary[DF3$Treatment=="Newspaper,Long,NuclearBetter"]))
length(na.omit(DF3$Scientist_Check_Binary[DF3$Treatment=="Newspaper,Short,Equal"]))
length(na.omit(DF3$Scientist_Check_Binary[DF3$Treatment=="Newspaper,Short,NuclearBetter"]))
length(na.omit(DF3$Scientist_Check_Binary[DF3$Treatment=="PlainText,Long,Equal"]))
length(na.omit(DF3$Scientist_Check_Binary[DF3$Treatment=="PlainText,Long,NuclearBetter"]))
length(na.omit(DF3$Scientist_Check_Binary[DF3$Treatment=="PlainText,Short,Equal"]))
length(na.omit(DF3$Scientist_Check_Binary[DF3$Treatment=="PlainText,Short,NuclearBetter"]))


```

```{r}

##### Author_Check_Binary

Author_Check_Binary_Form_1 <- Author_Check_Binary ~ Newspaper + Long + NukeAdv   


Author_Check_Binary_Full <- Author_Check_Binary ~ 0 + as.factor(Treatment) 


lm_Author_Check_Binary_Full <- lm(Author_Check_Binary_Full, 
                     data = DF3)

summary(lm_Author_Check_Binary_Full)

length(na.omit(DF3$Author_Check_Binary[DF3$Treatment=="Newspaper,Long,Equal"]))
length(na.omit(DF3$Author_Check_Binary[DF3$Treatment=="Newspaper,Long,NuclearBetter"]))
length(na.omit(DF3$Author_Check_Binary[DF3$Treatment=="Newspaper,Short,Equal"]))
length(na.omit(DF3$Author_Check_Binary[DF3$Treatment=="Newspaper,Short,NuclearBetter"]))
length(na.omit(DF3$Author_Check_Binary[DF3$Treatment=="PlainText,Long,Equal"]))
length(na.omit(DF3$Author_Check_Binary[DF3$Treatment=="PlainText,Long,NuclearBetter"]))
length(na.omit(DF3$Author_Check_Binary[DF3$Treatment=="PlainText,Short,Equal"]))
length(na.omit(DF3$Author_Check_Binary[DF3$Treatment=="PlainText,Short,NuclearBetter"]))


```

```{r}

##### Country_Check_Binary

Country_Check_Binary_Form_1 <- Country_Check_Binary ~ Newspaper + Long + NukeAdv   


Country_Check_Binary_Full <- Country_Check_Binary ~ 0 + as.factor(Treatment) 


lm_Country_Check_Binary_Full <- lm(Country_Check_Binary_Full, 
                     data = DF3)

summary(lm_Country_Check_Binary_Full)

length(na.omit(DF3$Country_Check_Binary[DF3$Treatment=="Newspaper,Long,Equal"]))
length(na.omit(DF3$Country_Check_Binary[DF3$Treatment=="Newspaper,Long,NuclearBetter"]))
length(na.omit(DF3$Country_Check_Binary[DF3$Treatment=="Newspaper,Short,Equal"]))
length(na.omit(DF3$Country_Check_Binary[DF3$Treatment=="Newspaper,Short,NuclearBetter"]))
length(na.omit(DF3$Country_Check_Binary[DF3$Treatment=="PlainText,Long,Equal"]))
length(na.omit(DF3$Country_Check_Binary[DF3$Treatment=="PlainText,Long,NuclearBetter"]))
length(na.omit(DF3$Country_Check_Binary[DF3$Treatment=="PlainText,Short,Equal"]))
length(na.omit(DF3$Country_Check_Binary[DF3$Treatment=="PlainText,Short,NuclearBetter"]))


```

## Experiential 

```{r}

##### Cog_Load

Cog_Load_Form_1 <- Cog_Load ~ Newspaper + Long + NukeAdv   


Cog_Load_Full <- Cog_Load ~ 0 + as.factor(Treatment) 


lm_Cog_Load_Full <- lm(Cog_Load_Full, 
                     data = DF3)

summary(lm_Cog_Load_Full)

length(na.omit(DF3$Cog_Load[DF3$Treatment=="Newspaper,Long,Equal"]))
length(na.omit(DF3$Cog_Load[DF3$Treatment=="Newspaper,Long,NuclearBetter"]))
length(na.omit(DF3$Cog_Load[DF3$Treatment=="Newspaper,Short,Equal"]))
length(na.omit(DF3$Cog_Load[DF3$Treatment=="Newspaper,Short,NuclearBetter"]))
length(na.omit(DF3$Cog_Load[DF3$Treatment=="PlainText,Long,Equal"]))
length(na.omit(DF3$Cog_Load[DF3$Treatment=="PlainText,Long,NuclearBetter"]))
length(na.omit(DF3$Cog_Load[DF3$Treatment=="PlainText,Short,Equal"]))
length(na.omit(DF3$Cog_Load[DF3$Treatment=="PlainText,Short,NuclearBetter"]))


```

```{r}

##### Enjoyment

Enjoyment_Form_1 <- Enjoyment ~ Newspaper + Long + NukeAdv   


Enjoyment_Full <- Enjoyment ~ 0 + as.factor(Treatment) 


lm_Enjoyment_Full <- lm(Enjoyment_Full, 
                     data = DF3)

summary(lm_Enjoyment_Full)

length(na.omit(DF3$Enjoyment[DF3$Treatment=="Newspaper,Long,Equal"]))
length(na.omit(DF3$Enjoyment[DF3$Treatment=="Newspaper,Long,NuclearBetter"]))
length(na.omit(DF3$Enjoyment[DF3$Treatment=="Newspaper,Short,Equal"]))
length(na.omit(DF3$Enjoyment[DF3$Treatment=="Newspaper,Short,NuclearBetter"]))
length(na.omit(DF3$Enjoyment[DF3$Treatment=="PlainText,Long,Equal"]))
length(na.omit(DF3$Enjoyment[DF3$Treatment=="PlainText,Long,NuclearBetter"]))
length(na.omit(DF3$Enjoyment[DF3$Treatment=="PlainText,Short,Equal"]))
length(na.omit(DF3$Enjoyment[DF3$Treatment=="PlainText,Short,NuclearBetter"]))


```


```{r}

##### Interest

Interest_Form_1 <- Interest ~ Newspaper + Long + NukeAdv   


Interest_Full <- Interest ~ 0 + as.factor(Treatment) 


lm_Interest_Full <- lm(Interest_Full, 
                     data = DF3)

summary(lm_Interest_Full)

length(na.omit(DF3$Interest[DF3$Treatment=="Newspaper,Long,Equal"]))
length(na.omit(DF3$Interest[DF3$Treatment=="Newspaper,Long,NuclearBetter"]))
length(na.omit(DF3$Interest[DF3$Treatment=="Newspaper,Short,Equal"]))
length(na.omit(DF3$Interest[DF3$Treatment=="Newspaper,Short,NuclearBetter"]))
length(na.omit(DF3$Interest[DF3$Treatment=="PlainText,Long,Equal"]))
length(na.omit(DF3$Interest[DF3$Treatment=="PlainText,Long,NuclearBetter"]))
length(na.omit(DF3$Interest[DF3$Treatment=="PlainText,Short,Equal"]))
length(na.omit(DF3$Interest[DF3$Treatment=="PlainText,Short,NuclearBetter"]))


```

# Graphs 

## Nuclear Questions 

```{r}

#put all the names, estimates, SEs, and behavior into one df for graphing 
Results_DF <- as.data.frame(matrix(data = c("Nuclear Approval", coeftest(NukeAppr_1)[2, 1:2],"no", 
                                   "Nuclear Approval", coeftest(NukeAppr_5)[2, 1:2], "yes",
                                   "Conventional Approval", coeftest(ConvAppr_1)[2, 1:2], "no",
                                   "Conventional Approval", coeftest(ConvAppr_5)[2, 1:2], "yes",
                                   "Preferred Choice", coeftest(Choice_1)[2, 1:2], "no",
                                   "Preferred Choice", coeftest(Choice_5)[2, 1:2], "yes"), 
                                   ncol = 4, byrow = TRUE))

colnames(Results_DF) <- c("dv", "estimate", "se", "controls")

#making into correct operators 
Results_DF$dv <- factor(Results_DF$dv, levels = c("Nuclear Approval", "Conventional Approval", "Preferred Choice"))
Results_DF$estimate <- as.numeric(Results_DF$estimate)
Results_DF$se <- as.numeric(Results_DF$se)

#adding in CIs 
q <- as.numeric(qnorm(p=.05/2, lower.tail=FALSE))
Results_DF$ci <- Results_DF$se*q


## graph time 
pd <- position_dodge(0.5)

ggplot(Results_DF, aes(x = dv, y = estimate, color = controls))  + 
  geom_point(aes(color=controls, shape=controls), position = pd) +
  geom_errorbar(aes(ymin = estimate - ci, ymax = estimate + ci), width = .2, position = pd) +
  theme_minimal() + xlab("Question") + ylab("ATE") + 
  geom_hline(yintercept = 0, linetype="dotted") +
  theme(axis.text.x = element_text(hjust = 1), text = element_text(size = 14)) + coord_flip()

#   ggtitle("ATE of Newspaper Treatment on Nuclear DVs") #removed for paper 

```


## Experiential Questions 


```{r}

#put all the names, estimates, SEs, and behavior into one df for graphing 
Results_DF <- as.data.frame(matrix(data = c("Interest", coeftest(Interest_1)[2, 1:2],"no", 
                                   "Interest", coeftest(Interest_5)[2, 1:2], "yes",
                                   "Enjoyment", coeftest(Enjoyment_1)[2, 1:2], "no",
                                   "Enjoyment", coeftest(Enjoyment_5)[2, 1:2], "yes",
                                    "Cognitive Load", coeftest(Cog_Load_1)[2, 1:2], "no",
                                   "Cognitive Load", coeftest(Cog_Load_5)[2, 1:2], "yes"), 
                                   ncol = 4, byrow = TRUE))

colnames(Results_DF) <- c("dv", "estimate", "se", "controls")

#making into correct operators 
Results_DF$dv <- factor(Results_DF$dv, levels = c("Interest", "Enjoyment", "Cognitive Load"))
Results_DF$estimate <- as.numeric(Results_DF$estimate)
Results_DF$se <- as.numeric(Results_DF$se)

#adding in CIs 
q <- as.numeric(qnorm(p=.05/2, lower.tail=FALSE))
Results_DF$ci <- Results_DF$se*q


## graph time 
pd <- position_dodge(0.5)

ggplot(Results_DF, aes(x = dv, y = estimate, color = controls))  + 
  geom_point(aes(color=controls, shape=controls), position = pd) +
  geom_errorbar(aes(ymin = estimate - ci, ymax = estimate + ci), width = .2, position = pd) +
  theme_minimal() + xlab("Question") + ylab("ATE") + 
  geom_hline(yintercept = 0, linetype="dotted") +
  theme(axis.text.x = element_text(hjust = 1), text = element_text(size = 14)) + coord_flip()

#   ggtitle("ATE of Newspaper Treatment on Experiential DVs") #removed for paper 

```

## AC Questions 


```{r}

#put all the names, estimates, SEs, and behavior into one df for graphing 
Results_DF <- as.data.frame(matrix(data = c("Country Check", coeftest(Country_Check_Binary_1)[2, 1:2],"no", 
                                   "Country Check", coeftest(Country_Check_Binary_5)[2, 1:2], "yes",
                                   "Author Check", coeftest(Author_Check_Binary_1)[2, 1:2], "no",
                                   "Author Check", coeftest(Author_Check_Binary_5)[2, 1:2], "yes",
                                   "Scientist Check", coeftest(Scientist_Check_Binary_1)[2, 1:2], "no",
                                   "Scientist Check", coeftest(Scientist_Check_Binary_5)[2, 1:2], "yes"), 
                                   ncol = 4, byrow = TRUE))

colnames(Results_DF) <- c("dv", "estimate", "se", "controls")

#making into correct operators 
Results_DF$dv <- factor(Results_DF$dv, levels = c("Country Check", "Author Check", "Scientist Check"))
Results_DF$estimate <- as.numeric(Results_DF$estimate)
Results_DF$se <- as.numeric(Results_DF$se)

#adding in CIs 
q <- as.numeric(qnorm(p=.05/2, lower.tail=FALSE))
Results_DF$ci <- Results_DF$se*q


## graph time 
pd <- position_dodge(0.5)

ggplot(Results_DF, aes(x = dv, y = estimate, color = controls))  + 
  geom_point(aes(color=controls, shape=controls), position = pd) +
  geom_errorbar(aes(ymin = estimate - ci, ymax = estimate + ci), width = .2, position = pd) +
  theme_minimal() + xlab("Question") + ylab("ATE") + 
  geom_hline(yintercept = 0, linetype="dotted") +
  theme(axis.text.x = element_text(hjust = 1), text = element_text(size = 14)) + coord_flip()

#   ggtitle("ATE of Newspaper Treatment on Attention Checks") #removed for paper 

```



# Difference in Difference

```{r}
# create split DFs for later 
DF_Newspaper <- subset(DF3, DF3$Newspaper==1)
DF_PlainText <- subset(DF3, DF3$Newspaper==0)

```

## Nuclear Advantage and Graphical Realism 

```{r}


### Difference in difference for Nuclear Approval 


Nuclear_Approval_Form_1_DiD <- Nuclear_Approval ~ Newspaper + NukeAdv + Newspaper*NukeAdv

Nuclear_Approval_Form_5_DiD <- Nuclear_Approval ~ Newspaper + NukeAdv + Newspaper*NukeAdv  +
 Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))



Nuclear_Approval_Form_7_DiD <- Nuclear_Approval ~ Newspaper + NukeAdv + Newspaper*NukeAdv  + 
   Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some


Nuclear_Approval_1_DiD <- lm(Nuclear_Approval_Form_1_DiD, data = DF3)
Nuclear_Approval_5_DiD <- lm(Nuclear_Approval_Form_5_DiD, data = DF3)
Nuclear_Approval_7_DiD <- lm(Nuclear_Approval_Form_7_DiD, data = DF3)

summary(lm(Nuclear_Approval_Form_1_DiD, data = DF3))
stargazer(Nuclear_Approval_1_DiD, Nuclear_Approval_5_DiD, Nuclear_Approval_7_DiD, title = "Nuclear_Approval, Difference in Difference", no.space = TRUE)

```






```{r}


### Difference in difference for Conventional Approval 


Conv_Approval_Form_1_DiD <- Conv_Approval ~ Newspaper + NukeAdv + Newspaper*NukeAdv

Conv_Approval_Form_5_DiD <- Conv_Approval ~ Newspaper + NukeAdv + Newspaper*NukeAdv  +
 Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))



Conv_Approval_Form_7_DiD <- Conv_Approval ~ Newspaper + NukeAdv + Newspaper*NukeAdv  + 
   Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some


Conv_Approval_1_DiD <- lm(Conv_Approval_Form_1_DiD, data = DF3)
Conv_Approval_5_DiD <- lm(Conv_Approval_Form_5_DiD, data = DF3)
Conv_Approval_7_DiD <- lm(Conv_Approval_Form_7_DiD, data = DF3)

summary(lm(Conv_Approval_Form_1_DiD, data = DF3))
stargazer(Conv_Approval_1_DiD, Conv_Approval_5_DiD, Conv_Approval_7_DiD, title = "Conv_Approval, Difference in Difference", no.space = TRUE)

```


```{r}


### Difference in difference for choice 


Choice_Form_1_DiD <- Choice ~ Newspaper + NukeAdv + Newspaper*NukeAdv

Choice_Form_5_DiD <- Choice ~ Newspaper + NukeAdv + Newspaper*NukeAdv  +
 Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))



Choice_Form_7_DiD <- Choice ~ Newspaper + NukeAdv + Newspaper*NukeAdv  + 
   Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some


Choice_1_DiD <- lm(Choice_Form_1_DiD, data = DF3)
Choice_5_DiD <- lm(Choice_Form_5_DiD, data = DF3)
Choice_7_DiD <- lm(Choice_Form_7_DiD, data = DF3)

summary(lm(Choice_Form_1_DiD, data = DF3))
stargazer(Choice_1_DiD, Choice_5_DiD, Choice_7_DiD, title = "Choice, Difference in Difference", no.space = TRUE)

```

```{r}
coef(summary(lm(Conv_Approval_Form_1_DiD, data = DF3)))
coef(summary(lm(Conv_Approval_Form_1_DiD, data = DF3)))[4,1]
coef(summary(lm(Conv_Approval_Form_1_DiD, data = DF3)))[4,2]


```


```{r}
#DiD Graph

DiD_DF <- as.data.frame(matrix(data = 
                                 c(coef(summary(lm(Nuclear_Approval_Form_1_DiD, data = DF3)))[4,1], "Nuclear Approval",
                                   coef(summary(lm(Nuclear_Approval_Form_1_DiD, data = DF3)))[4,2],
                                   coef(summary(lm(Conv_Approval_Form_1_DiD, data = DF3)))[4,1], "Conventional Approval",
                                   coef(summary(lm(Conv_Approval_Form_1_DiD, data = DF3)))[4,2], 
                                   coef(summary(lm(Choice_Form_1_DiD, data = DF3)))[2,1], "Preferred Choice", 
                                   coef(summary(lm(Choice_Form_1_DiD, data = DF3)))[2,2]),
                               ncol=3, byrow = TRUE))

colnames(DiD_DF) <- c("Difference", "Medium", "se")
DiD_DF$Medium <- factor(DiD_DF$Medium, levels = c("Nuclear Approval", "Conventional Approval", "Preferred Choice"))
DiD_DF$Difference <- as.numeric(DiD_DF$Difference)
DiD_DF$se <- as.numeric(DiD_DF$se)
q <- as.numeric(qnorm(p=.05/2, lower.tail=FALSE))
DiD_DF$ci <- DiD_DF$se*q


ggplot(DiD_DF, aes(x = Medium, y = Difference, color = Medium, fill = Medium))  + 
  geom_bar(stat="identity", show.legend = FALSE)  +
  theme_minimal() + xlab("Dependent Variable") + ylab("Difference b/w estimates of Nuclear Advantage Coefficient") + 
   geom_errorbar( aes(x=Medium, ymin=Difference-ci, ymax=Difference+ci), width=0.4, colour="black")

# removed for paper:  ggtitle("Difference in difference, Newspaper vs. Plain Text, No Controls, 95% CIs") + 

```

## Diff-in-diff, Length and Graphical Realism 

```{r}


### Difference in difference for Interest


Interest_Form_1_DiD <- Interest ~ Newspaper + Long + Newspaper*Long

Interest_Form_5_DiD <- Interest ~ Newspaper + Long + Newspaper*Long  +
 Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))



Interest_Form_7_DiD <- Interest ~ Newspaper + Long + Newspaper*Long  + 
   Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some


Interest_1_DiD <- lm(Interest_Form_1_DiD, data = DF3)
Interest_5_DiD <- lm(Interest_Form_5_DiD, data = DF3)
Interest_7_DiD <- lm(Interest_Form_7_DiD, data = DF3)

summary(lm(Interest_Form_1_DiD, data = DF3))
stargazer(Interest_1_DiD, Interest_5_DiD, Interest_7_DiD, title = "Interest, Difference in Difference", no.space = TRUE)

```


```{r}


### Difference in difference for Conventional Approval 


Enjoyment_Form_1_DiD <- Enjoyment ~ Newspaper + Long + Newspaper*Long

Enjoyment_Form_5_DiD <- Enjoyment ~ Newspaper + Long + Newspaper*Long  +
 Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))



Enjoyment_Form_7_DiD <- Enjoyment ~ Newspaper + Long + Newspaper*Long  + 
   Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some


Enjoyment_1_DiD <- lm(Enjoyment_Form_1_DiD, data = DF3)
Enjoyment_5_DiD <- lm(Enjoyment_Form_5_DiD, data = DF3)
Enjoyment_7_DiD <- lm(Enjoyment_Form_7_DiD, data = DF3)

summary(lm(Enjoyment_Form_1_DiD, data = DF3))
stargazer(Enjoyment_1_DiD, Enjoyment_5_DiD, Enjoyment_7_DiD, title = "Enjoyment, Difference in Difference", no.space = TRUE)

```


```{r}


### Difference in difference for Cog_Load 


Cog_Load_Form_1_DiD <- Cog_Load ~ Newspaper + Long + Newspaper*Long

Cog_Load_Form_5_DiD <- Cog_Load ~ Newspaper + Long + Newspaper*Long  +
 Q.Female +
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.HighSchool + Q.Bach + 
  factor(Q.Income, ordered = TRUE, levels = c(1, 2, 3, 4, 5, 6, 7, 8)) +  #treats income as an ordered factor
  factor(Q.Political_ID, ordered = TRUE, levels = c(1, 2, 3, 4, 5)) + #treats party as an ordered factor 
  Q.Veteran + factor(Q.Twitter_Use, ordered = TRUE, levels = c(1, 2, 3, 4, 5))



Cog_Load_Form_7_DiD <- Cog_Load ~ Newspaper + Long + Newspaper*Long  + 
   Q.Female + 
  relevel(as.factor(Q.Race), ref = 1) + #makes white the reference cat
  Q.Age + Q.Bach + Q.Income +  #treats income as a continuous variable, removes high school dummy 
  Q.Conservative + Q.Liberal + #uses party binaries 
  Q.Veteran + Q.Twitter_Some


Cog_Load_1_DiD <- lm(Cog_Load_Form_1_DiD, data = DF3)
Cog_Load_5_DiD <- lm(Cog_Load_Form_5_DiD, data = DF3)
Cog_Load_7_DiD <- lm(Cog_Load_Form_7_DiD, data = DF3)

summary(lm(Cog_Load_Form_1_DiD, data = DF3))
stargazer(Cog_Load_1_DiD, Cog_Load_5_DiD, Cog_Load_7_DiD, title = "Cog_Load, Difference in Difference", no.space = TRUE)

```

```{r}
coef(summary(lm(Enjoyment_Form_1_DiD, data = DF3)))
coef(summary(lm(Enjoyment_Form_1_DiD, data = DF3)))[4,1]
coef(summary(lm(Enjoyment_Form_1_DiD, data = DF3)))[4,2]


```


```{r}
#DiD Graph

DiD_DF <- as.data.frame(matrix(data = 
                                 c(coef(summary(lm(Interest_Form_1_DiD, data = DF3)))[4,1], "Interest",
                                   coef(summary(lm(Interest_Form_1_DiD, data = DF3)))[4,2],
                                   coef(summary(lm(Enjoyment_Form_1_DiD, data = DF3)))[4,1], "Enjoyment",
                                   coef(summary(lm(Enjoyment_Form_1_DiD, data = DF3)))[4,2], 
                                   coef(summary(lm(Cog_Load_Form_1_DiD, data = DF3)))[2,1], "Cognitive Load", 
                                   coef(summary(lm(Cog_Load_Form_1_DiD, data = DF3)))[2,2]),
                               ncol=3, byrow = TRUE))

colnames(DiD_DF) <- c("Difference", "Medium", "se")
DiD_DF$Medium <- factor(DiD_DF$Medium, levels = c("Interest", "Enjoyment", "Cognitive Load"))
DiD_DF$Difference <- as.numeric(DiD_DF$Difference)
DiD_DF$se <- as.numeric(DiD_DF$se)
q <- as.numeric(qnorm(p=.05/2, lower.tail=FALSE))
DiD_DF$ci <- DiD_DF$se*q


ggplot(DiD_DF, aes(x = Medium, y = Difference, color = Medium, fill = Medium))  + 
  geom_bar(stat="identity", show.legend = FALSE)  +
  theme_minimal() + xlab("Dependent Variable") + ylab("Difference b/w estimates of Length Coefficient") + 
   geom_errorbar( aes(x=Medium, ymin=Difference-ci, ymax=Difference+ci), width=0.4, colour="black")

# removed for paper:  ggtitle("Difference in difference, Newspaper vs. Plain Text, No Controls, 95% CIs") + 

```





# Equivalence Testing 

```{r}

#############Nuclear_Approval################################


#using the TOSTER package 
#two sample Welch test equivalence 
#needs several inputs 

Avg_Newspaper <- mean(as.numeric(DF3$Nuclear_Approval[DF3$Newspaper==1]))
Avg_PlainText <- mean(as.numeric(DF3$Nuclear_Approval[DF3$Newspaper==0]))
SD_Newspaper <- sd(as.numeric(DF3$Nuclear_Approval[DF3$Newspaper==1]))
SD_PlainText <- sd(as.numeric(DF3$Nuclear_Approval[DF3$Newspaper==0]))
N_Newspaper <- length(DF3$Nuclear_Approval[DF3$Newspaper==1])
N_PlainText <- length(DF3$Nuclear_Approval[DF3$Newspaper==0])
LowerBound <- 6/20 #1/20 of scale 
HigherBound <- 6/20 #1/20 of scale
Alpha <- 0.05 #traditional


TOSTtwo(m1=Avg_Newspaper, m2=Avg_PlainText, 
        sd1=SD_Newspaper, sd2=SD_PlainText, 
        n1=N_Newspaper, n2=N_PlainText, 
        low_eqbound_d=-LowerBound, high_eqbound_d=HigherBound, alpha = Alpha)


```
```{r}

#############Conv_Approval################################


#using the TOSTER package 
#two sample Welch test equivalence 
#needs several inputs 

Avg_Newspaper <- mean(as.numeric(DF3$Conv_Approval[DF3$Newspaper==1]))
Avg_PlainText <- mean(as.numeric(DF3$Conv_Approval[DF3$Newspaper==0]))
SD_Newspaper <- sd(as.numeric(DF3$Conv_Approval[DF3$Newspaper==1]))
SD_PlainText <- sd(as.numeric(DF3$Conv_Approval[DF3$Newspaper==0]))
N_Newspaper <- length(DF3$Conv_Approval[DF3$Newspaper==1])
N_PlainText <- length(DF3$Conv_Approval[DF3$Newspaper==0])
LowerBound <- 6/20 #1/20 of scale  
HigherBound <- 6/20 #1/20 of scale
Alpha <- 0.05 #traditional


TOSTtwo(m1=Avg_Newspaper, m2=Avg_PlainText, 
        sd1=SD_Newspaper, sd2=SD_PlainText, 
        n1=N_Newspaper, n2=N_PlainText, 
        low_eqbound_d=-LowerBound, high_eqbound_d=HigherBound, alpha = Alpha)


```



```{r}

#############Choice################################


#using the TOSTER package 
#two sample Welch test equivalence 
#needs several inputs 

Avg_Newspaper <- mean(as.numeric(DF3$Choice[DF3$Newspaper==1]))
Avg_PlainText <- mean(as.numeric(DF3$Choice[DF3$Newspaper==0]))
SD_Newspaper <- sd(as.numeric(DF3$Choice[DF3$Newspaper==1]))
SD_PlainText <- sd(as.numeric(DF3$Choice[DF3$Newspaper==0]))
N_Newspaper <- length(DF3$Choice[DF3$Newspaper==1])
N_PlainText <- length(DF3$Choice[DF3$Newspaper==0])
LowerBound <- 4/20 #1/20 of scale 
HigherBound <- 4/20 #1/20 of scale 
Alpha <- 0.05 #traditional


TOSTtwo(m1=Avg_Newspaper, m2=Avg_PlainText, 
        sd1=SD_Newspaper, sd2=SD_PlainText, 
        n1=N_Newspaper, n2=N_PlainText, 
        low_eqbound_d=-LowerBound, high_eqbound_d=HigherBound, alpha = Alpha)


```

# Power 


```{r}

library(BDEsize)

nuk.factor.lev <- c(2,2,2)
x.vals <- seq(from = 0.01, to = 0.50, by = 0.001)

y.vals <- c()
z.vals <- c()
for (i in 1:length(x.vals)){
  answer <- Size.Full(factor.lev = nuk.factor.lev, interaction = TRUE, delta_type = 1, delta = c(x.vals[i], 0.10, 1), alpha = 0.05, beta = 0.2, maxsize = 500000) #allow for interaction effects
  y.vals[i] <- answer$n
  z.vals[i] <- answer$Delta[1]
}


DFplot <- as.data.frame(cbind(x.vals, y.vals, z.vals))
colnames(DFplot) <- c("MDES", "Sample.Size", "test")


ggplot(data = DFplot, aes(x=MDES, y = Sample.Size)) + 
  geom_line() + geom_hline(aes(yintercept=1793)) + theme_classic()

```
```{r}

library(BDEsize)

nuk.factor.lev <- c(2,2,2)
x.vals <- seq(from = 0.01, to = 0.50, by = 0.001)

y.vals <- c()
z.vals <- c()
for (i in 1:length(x.vals)){
  answer <- Size.Full(factor.lev = nuk.factor.lev, interaction = TRUE, delta_type = 1, delta = c(0.10, x.vals[i], 1), alpha = 0.05, beta = 0.2, maxsize = 500000) #allow for interaction effects
  y.vals[i] <- answer$n
  z.vals[i] <- answer$Delta[1]
}


DFplot <- as.data.frame(cbind(x.vals, y.vals, z.vals))
colnames(DFplot) <- c("Interaction.Effect", "Sample.Size", "test")


ggplot(data = DFplot, aes(x=Interaction.Effect, y = Sample.Size)) + 
  geom_line() + geom_hline(aes(yintercept=1793)) + theme_classic()

```








```{r}


```

